Skip to content

Provide an API to interact with CalDav server #1465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 11, 2025

Conversation

HoussemNasri
Copy link
Contributor

@HoussemNasri HoussemNasri commented Jan 15, 2025

Closes #1462

TODO:

  • Use the If-Match header not to update calendar objects that changed since they have been retrieved.

@HoussemNasri
Copy link
Contributor Author

Note: For some reason, I had to force push. Anyway, the only new commit is c448e55.

@HoussemNasri HoussemNasri marked this pull request as ready for review January 24, 2025 13:24
Comment on lines 162 to 230
.switchIfEmpty(Mono.fromRunnable(
() -> LOGGER.trace("VEvent '{}' was not found in Calendar '{}'.", eventUid, calendarURI)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReactorUtils.logAsMono in order to be more idiomatic.

Copy link
Contributor Author

@HoussemNasri HoussemNasri Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't because logAsMono is not generic. It returns Mono<Void> while we need Mono<Calendar>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReactorUtils.logAsMono(() -> LOGGER...).thenReturn(calendar) ???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then we need to thenReturn(null). In my opinion, unless we make logAsMono generic, this is the best syntax we can achieve.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, done. Should we open a PR in James to make logAsMono generic?

@chibenwa
Copy link
Member

An alternative solution is we use this fork https://github.com/nmondal/spark-11/blob/master/pom.xml

To be adopted at the James scale if needed. Feel free to post an email about this onto [email protected].

@chibenwa
Copy link
Member

@HoussemNasri you need to rebase in order to solve conflict

@chibenwa
Copy link
Member

Use the If-Match header not to update calendar objects that changed since they have been retrieved.

Basic rule when doing optimistic transactions:

This will need to be retried.

THe total number of retries need to be bounded and low: 5 max....

@chibenwa
Copy link
Member

Reviewed.

There is still a merge conflict over here!

@chibenwa
Copy link
Member

Can we write a clean history here with ISSUE-XXX as a commit message prefix?

<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>3.10.0</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgotten <scope>test</scope>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to summarize the current issue with dependencies:

  • Wiremock imports a library called json-schema-validator.
  • This library is being imported by mockserver too but uses an old and uncompatible version.
  • At class-load time, this library reads a localization JSON file, parses it, and caches the object in memory.
  • This file is not stored under a package name but rather stored in the root of the resources folder.
  • This creates a conflict between the two localization files imported by Wiremock and Mockserver and one would override the other.
  • As the versions of the library imported are incompatible, using the code of version A to read the config of version B fails.
  • The two versions can co-exist because the wiremock library is imported as standalone: https://github.com/wiremock/wiremock/blob/f91326573547a90fd143252d77961eaa0345dbb1/build.gradle#L284

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok shading dependencies is really OK in this context.

@Arsnael
Copy link
Member

Arsnael commented Feb 3, 2025

[ERROR] Crashed tests:
[ERROR] com.linagora.tmail.james.app.MemoryServerWithOpenPaasConfiguredTest$DavConfigured

@vttranlina
Copy link
Member

We've updated ical4j to version 4.1.0 in tmail-backend

cecccc2

@chibenwa
Copy link
Member

Can we rebase this @HoussemNasri ? And also fix the build...

<artifactId>wiremock-standalone</artifactId>
<version>3.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which tests uses mock-server in this module?

HoussemNasri and others added 13 commits February 11, 2025 10:08
… operations

- Implemented parsing of DAV multistatus responses
- Implemented user calendar discovery via PROPFIND requests
- Added WireMock for testing PROPFIND and REPORT methods as mockserver does not support custom HTTP methods.
Remove uncalled constructors in Dav exceptions

Remove unneeded dependency

Polish DavClient

 - Line break management
 - Avoid a bit code duplication
 - Use specialized UnaryOperator
 - static and final where possible

Fix wiremock tests

Drop unused test method

Simplify DavServerExtension

Drop mockserver

Fix broken tests after dropping mockserver

tmail-openpaas: Drop scala as it is no longer needed

Remove mockserver from third-party/openpaas maven module

Because it clashes with wiremock, which is needed for custom HTTP methods.
Dependency clash will not be manageable on the long run.

Co-authored-by: Benoit Tellier <[email protected]>
@chibenwa chibenwa merged commit 7bd97c7 into linagora:master Feb 11, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an API to interact with CalDav server
4 participants